public class test2 {


    public static void main(String[] args) {
        int cnt =0;
        for(int n=0 ;n<=20000;n++ ){
            if(isPrime(n)){
                if(cnt++%5==0){
                    System.out.println();
                }
                System.out.println(n + "");
            }
        }

    }
    public static boolean isPrime(int num) {
        if (num < 2) {

            return false;
        }
        for (int i = 2; i <= Math.sqrt(num); i++) {
            if (num % i == 0) {
                return false;
            }
        }

        return true;
    }
}